﻿<phone:PhoneApplicationPage 
    x:Class="SandwichFlow.SandwichRecipe"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:loc="clr-namespace:SandwichFlow"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:mim="clr-namespace:MetroInMotionUtils"
    xmlns:behaviour="clr-namespace:WP7Contrib.View.Controls.Behaviors;assembly=WP7Contrib.View.Controls"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    xmlns:contribControls="clr-namespace:WP7Contrib.View.Controls;assembly=WP7Contrib.View.Controls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="White"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot Title="SandwichFlow"
                    Foreground="Black">

            <!-- Ingredients -->
            <controls:PivotItem Header="Ingredients">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="150"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <loc:SandwichIngredients>
                        <i:Interaction.Behaviors>
                            <behaviour:PivotSlideBehaviour/>
                        </i:Interaction.Behaviors>
                    </loc:SandwichIngredients>

                    <TextBlock Text="{Binding Title}"
                                x:Name="Title"
                                TextAlignment="Center"
                                FontSize="{StaticResource PhoneFontSizeLarge}"
                                TextWrapping="Wrap"
                                Grid.Row="1">
                        <i:Interaction.Behaviors>
                            <behaviour:FlyInBehaviour/>
                        </i:Interaction.Behaviors>
                    </TextBlock>

                    <ScrollViewer Grid.Row="2">
                        <ItemsControl ItemsSource="{Binding Ingredients}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical">
                                        <TextBlock Text="{Binding}"
                                                   TextWrapping="Wrap"
                                                   Foreground="#333"
                                                   FontSize="{StaticResource PhoneFontSizeMedium}"
                                                   Margin="0,8,0,8"/>
                                        <Line X1="0" Y1="0" X2="300" Y2="0"
                                              StrokeThickness="2"
                                              Stroke="LightGray"
                                              HorizontalAlignment="Center"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </Grid>
            </controls:PivotItem>

            <!-- Preparation -->
            <controls:PivotItem Header="Preparation">
                <Grid>
                    <ItemsControl ItemsSource="{Binding Instructions}">
                        <i:Interaction.Behaviors>
                            <behaviour:PivotSlideBehaviour/>
                        </i:Interaction.Behaviors>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.Template>
                            <ControlTemplate>
                                <ScrollViewer>
                                    <ItemsPresenter/>
                                </ScrollViewer>
                            </ControlTemplate>
                        </ItemsControl.Template>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="0,10,0,0">
                                    <StackPanel Orientation="Vertical">
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text=" - "
                                                         FontWeight="Bold"/>
                                            <TextBlock Text="{Binding Step}"
                                                         FontWeight="Bold"/>
                                            <TextBlock Text=" - "
                                                         FontWeight="Bold"/>
                                        </StackPanel>
                                        <TextBlock Text="{Binding Text}"
                                                    TextWrapping="Wrap"
                                                    FontSize="{StaticResource PhoneFontSizeMedium}"
                                                    behaviour:PivotSlideBehaviour.AnimationLevel="1"/>
                                    </StackPanel>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </Grid>
            </controls:PivotItem>

            <controls:PivotItem Header="Similar">
                <Grid>
                    <contribControls:NavigationList  x:Name="similarList"
                                           ItemsSource="{Binding Similar}"
                                           VerticalAlignment="Top"
                                           Navigation="NavigationList_Navigation"
                                           ItemTemplate="{StaticResource SandwichTemplate}">
                        <i:Interaction.Behaviors>
                            <behaviour:PivotSlideBehaviour/>
                        </i:Interaction.Behaviors>
                    </contribControls:NavigationList>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>

</phone:PhoneApplicationPage>